import cv2
import numpy as np
import matplotlib.pyplot as plt
img=cv2.imread('tk.jpeg')
height=img.shape[0]
width=img.shape[1]
new_img=np.zeros((height,width,3),np.uint8)
for i in range(height):
    for j in range(width):
        for k in range(3):
            quantized_value = (img[i, j][k] // 32) * 32 + 16
            new_img[i,j][k]=np.uint8(quantized_value)
img_rgb=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
new_img_rgb=cv2.cvtColor(new_img,cv2.COLOR_BGR2RGB)
plt.figure(figsize=(10,5))
plt.subplot(1,2,1)
plt.imshow(img_rgb)
plt.title('Orinel Image')
plt.axis('off')
plt.subplot(1,2,2)
plt.imshow(new_img_rgb)
plt.title('Quantized Image')
plt.axis('off')
plt.show()